package jdo.editors;

import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IWordDetector;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WordRule;

public class JDOPartitionScanner extends RuleBasedScanner {

	private static TextAttribute commentAttr = new TextAttribute(
			ColorManager.getColor(ColorManager.COLOR_COMMENT));

	private static TextAttribute packageAttr = new TextAttribute(
			ColorManager.getColor(ColorManager.COLOR_KEYWORD));

	private static TextAttribute classAttr = new TextAttribute(
			ColorManager.getColor(ColorManager.COLOR_TEXT));

	private static TextAttribute methodAttr = new TextAttribute(
			ColorManager.getColor(ColorManager.COLOR_COMMENT));

	public JDOPartitionScanner() {
		IRule[] rules = new IRule[4];
		rules[0] = new SingleLineRule("#", null, new Token(commentAttr));

		rules[1] = new SingleLineRule("p", "p", new Token(packageAttr));
		rules[2] = new SingleLineRule("c", "c", new Token(packageAttr));
		rules[3] = new SingleLineRule("m", "m", new Token(packageAttr));
		setRules(rules);
	}
}